package com.zj.leetcode.medium.hash;

/**
 * @program: algorithm
 * @description: 平方数之和
 * 633 sum-of-square-numbers
 * @author: Zhang Bo
 * @create: 2022-01-14 17:05
 **/
public class SumOfSquareNumbers {
    public static void main(String[] args) {
        Solution solution = new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    static class Solution {
        public boolean judgeSquareSum(int c) {

            for (long i = 0; i * i <= c; i++) {
                double temp = Math.sqrt(c - i * i);
                if (temp == (int) temp) {
                    return true;
                }
            }
            return false;
        }

        public boolean judgeSquareSum01(int c) {

            for (long i = 0; i * i <= c; i++) {
                double temp = Math.sqrt(c - i * i);
                if (temp == (int) temp) {
                    return true;
                }
            }
            return false;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}